<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form" lay-filter="expert">
	<div class="layui-form-item" style="width:800px;">
		<input type="hidden" name="id" id="id"/>
        <label class="layui-form-label">专家名称</label>
        <div class="layui-input-block">
            <input type="text" name="exportName" readonly="readonly" placeholder="请输入专家名称" value="" class="layui-input">            
        </div>
    </div>
    <div class="layui-form-item">
     	<label class="layui-form-label">个人照片</label>
	   <div id="demo"></div>
   		<input type="hidden" name="exportPic" id="exportPic"/>
	</div>
	<div class="layui-form-item" style="width:800px;">
        <label class="layui-form-label">教育背景</label>
        <div class="layui-input-block">
        	<input type="text" name="educationalBackground" readonly="readonly" placeholder="请输入教育背景" value="" class="layui-input">
	    </div>
    </div>
    <div class="layui-form-item" style="width:800px;">
        <label class="layui-form-label">毕业院校</label>
        <div class="layui-input-block">
            <input type="text" name="schoolName" readonly="readonly" lay-verify="required" lay-reqtext="毕业院校不能为空" placeholder="请输入毕业院校" value="" class="layui-input">            
        </div>
    </div>
   <div class="layui-form-item" style="width:800px;">
        <label class="layui-form-label">技术领域</label>
        <div class="layui-input-block">
        	<input type="text" name="technicalField" readonly="readonly" placeholder="请输入技术领域" value="" class="layui-input">
	    </div>
    </div>
    <div class="layui-form-item" style="width:800px;">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="text" name="sex" readonly="readonly" placeholder="请输入性别" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" style="width:800px;">
        <label class="layui-form-label">工作单位</label>
        <div class="layui-input-block">
            <input type="text" name="workName" readonly="readonly" placeholder="请输入工作单位" value="" class="layui-input">            
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
        	<button class="layui-btn layui-btn-normal" id="edit">修改</button>
        </div>
    </div>
</div>
<script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script>
    layui.use(['form','upload'], function () {
        var form = layui.form,
            layer = layui.layer,
            upload = layui.upload,
            $ = layui.$;
        
        layer.ready(function(){
        	 $.post("getOneById",{'id':localStorage.getItem("companyId")}, function (data) {
	        	 var data=data.data;
      		//表单初始赋值
      	        form.val('expert', {
      	        	"id":data.id
      	            ,"exportName": data.exportName
      	            ,"educationalBackground":data.educationalBackground
      	            ,"schoolName":data.schoolName
      	            ,"technicalField":data.technicalField
      	          	,"sex":data.sex
    	            ,"workName":data.workName
    	            ,"exportPic":data.exportPic
      	        });
      	        form.render();
      	        
      	      $("#demo").append("<div class=\"layui-upload layui-inline\"><div class=\"layui-upload-list\">"+
      	    		"<img class=\"layui-upload-img\" src=\""+$("#exportPic").val()+"\" onerror=\"../images/img.png\" onclick=\"bigPicture(this)\" style=\"width:120px;height:120px\"></div></div>");
      	      });
         }); 
            
          $('#edit').on("click", function () {
              window.open('edit?id='+$("#id").val(),'_self');       
          });       
    });
    
    function bigPicture(e) {
        var vUrl = $(e).attr('src');  //获取url
        var loadstr = '<img width="100%" height="100%" src='+vUrl+'/>';
        layer.open({
            type: 1,
            title: false,
            area: ['730px', '500px'],
            shade: [0.8, 'rgb(14, 16, 22)'],
            skin: 'demo-class',
            content: loadstr
        });
	} 
</script>
</body>
</html>